package org.jivesoftware.smackx.pubsub.provider;

import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.jivesoftware.smackx.pubsub.Subscription;
import org.jivesoftware.smackx.pubsub.Subscription.State;
import org.xmlpull.v1.XmlPullParser;

public class SubscriptionProvider
  implements PacketExtensionProvider
{
  public PacketExtension parseExtension(XmlPullParser paramXmlPullParser)
    throws Exception
  {
    Subscription.State localState;
    String str1 = paramXmlPullParser.getAttributeValue(null, "jid");
    String str2 = paramXmlPullParser.getAttributeValue(null, "node");
    String str3 = paramXmlPullParser.getAttributeValue(null, "subid");
    String str4 = paramXmlPullParser.getAttributeValue(null, "subscription");
    boolean bool = false;
    if ((paramXmlPullParser.next() == 2) && (paramXmlPullParser.getName().equals("subscribe-options")))
    {
      if ((paramXmlPullParser.next() == 2) && (paramXmlPullParser.getName().equals("required")))
        bool = true;
      do;
      while ((paramXmlPullParser.next() != 3) && (paramXmlPullParser.getName() != "subscribe-options"));
    }
    if (paramXmlPullParser.getEventType() == 3)
    {
      if (str4 != null)
        break label161;
      localState = null;
    }
    while (true)
    {
      while (true)
      {
        return new Subscription(str1, str2, str3, localState, bool);
        paramXmlPullParser.next();
      }
      label161: localState = Subscription.State.valueOf(str4);
    }
  }
}